﻿using System.Drawing;

namespace Marmat.Forms.Views
{
    namespace Grid
    {
        public class RowCellCustomDrawEventArgs
        {
            internal DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs info;
            internal BaseGrid _GridControl;

            internal RowCellCustomDrawEventArgs(BaseGrid gridControl, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs info)
            {
                this.info = info;
                this._GridControl = gridControl;
            }

            public virtual DevExpress.Utils.AppearanceObject Appearance
            {
                get
                {
                    return this.info.Appearance;
                }
            }

            public virtual Rectangle Bounds
            {
                get
                {
                    return this.info.Bounds;
                }
            }

            public DevExpress.Utils.Drawing.GraphicsCache Cache
            {
                get
                {
                    return this.info.Cache;
                }
            }

            public BaseGrid GridControl
            {
                get
                {
                    return this._GridControl;
                }
            }

            public object Cell
            {
                get
                {
                    return this.info.Cell;
                }
            }

            public object CellValue
            {
                get
                {
                    return this.info.CellValue;
                }

                set
                {
                    this.info.CellValue = value;
                }
            }

            public object Row
            {
                get
                {
                    object Result = null;
                    if (this.info.RowHandle >= 0)
                    {
                        Result = this.GridControl.GetRow(this.info.RowHandle);
                    }

                    return Result;
                }
            }

            public Column Column
            {
                get
                {
                    return (Column)this.info.Column.Tag;
                }
            }

            public string DisplayText
            {
                get
                {
                    return this.info.DisplayText;
                }

                set
                {
                    this.info.DisplayText = value;
                }
            }

            public Graphics Graphics
            {
                get
                {
                    return this.info.Graphics;
                }
            }

            /// <summary>
            /// 获取或设置一个值，该值指定是否处理了事件并将其作为默认值，因此不需要元素绘制。
            /// </summary>
            /// <returns>如果不需要绘制默认元素，则为true；否则为false。</returns>
            public bool Handled
            {
                get
                {
                    return this.info.Handled;
                }

                set
                {
                    this.info.Handled = value;
                }
            }

            public int RowHandle
            {
                get
                {
                    return this.info.RowHandle;
                }
            }

            /// <summary>
            /// 执行元素的默认绘制。
            /// </summary>
            public void DefaultDraw()
            {
                this.info.DefaultDraw();
            }
        }
    }
}